package com.qingke.Memorandum;

import java.util.Scanner;

public class QingkeConsole {
	public static Scanner sc = new Scanner(System.in);

	private QingkeConsole() {

	}

	public static void println(String str) {
		System.out.println(str);
	}

	public static void print(Object obj) {
		System.out.println(obj);
	}

	public static String askUserInput(String prompt) {
		while (true) {
			System.out.println(prompt + ">");
			String input = sc.nextLine().trim();
			if (!"".equals(input)) {
				return input;
			}
			System.out.println("请重新输入！");
 
		}
	}

	public static int askUserInputInt(String prompt) {
		int result = -1;
		while (true) {
			String out = askUserInput(prompt);
			try {
				result = Integer.parseInt(out);
				break;
			} catch (Exception e) {
				println("请输入合法的数字：");
			}
		}
		return result;
	}
	
}
